package bean;

import lombok.*;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @classname:GoodInfo
 * @description:
 * @author: Mr.Z
 * @date: 2020/12/31 23:53
 * @version: 0.1
 * @since:1.8
 */
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@ToString
public class GoodInfo {
    private Integer id;
    private String gname;
    private Integer pid;
    private Integer number;
    private Float price;
    private Integer gstatus;
    private Float discount;
    private Date create_time;
    private Date update_time;

    public GoodInfo(ResultSet rs){
        try {
            this.id = rs.getInt("id");
            this.gname = rs.getString("gname");
            this.pid = rs.getInt("pid");
            this.number = rs.getInt("number");
            this.price = rs.getFloat("price");
            this.gstatus = rs.getInt("gstatus");
            this.discount = rs.getFloat("discount");
            this.create_time = (Date) rs.getObject("create_time");
            this.update_time = (Date) rs.getObject("update_time");
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
